package com.his.controller;

import com.his.pojo.RegistLevel;
import com.his.service.RegistLevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class RegistLevelController {

    @Autowired
    private RegistLevelService registLevelService;


    /*处理加载挂号级别列表的请求*/
    @CrossOrigin
    @GetMapping("/initRegistLevel")
    public List<RegistLevel> initRegistLevel(){
        return registLevelService.list();
    }

    /*处理根据挂号级别获得挂号金额的请求*/
    @CrossOrigin
    @GetMapping("/getRegisterMOney")
    public Map<String,Object> getRegisterMOney(Integer id){
        RegistLevel registLevel = registLevelService.getById(id);
        Map<String,Object> result=new HashMap<>();
        result.put("money",registLevel.getRegistFee());
        return result;
    }
}
